# -*- coding: utf-8 -*-
# 验证给定的字符串是否可以解释为十进制数字

# 例如:
# "0" => true
# " 0.1 " => true
# "abc" => false
# "1 a" => false
# "2e10" => true
# " -90e3   " => true
# " 1e" => false
# "e3" => false
# " 6e-1" => true
# " 99e2.5 " => false
# "53.5e93" => true
# " --6 " => false
# "-+3" => false
# "95a54e53" => false

# 说明: 我们有意将问题陈述地比较模糊。在实现代码之前，你应当事先思考所有可能的情况。这里给出一份可能存在于有效十进制数字中的字符列表：
# 数字 0-9
# 指数 - "e"
# 正/负号 - "+"/"-"
# 小数点 - "."
# 当然，在输入中，这些字符的上下文也很重要

# # 整数
# # 小数 = "" or 整数 + "." + "" or 整数
# # 指数 = 整数 or 小数 + "e" + "整数"
# # 符号位
# class Solution(object):
#     def isNumber(self, s):
#         """
#         :type s: str
#         :rtype: bool
#         """

#         # 是否全是数字
#         def is_digital(s):
#             if len(s) == 0:
#                 return False;

#             for i in range(len(s)):
#                 if ord(s[i]) < ord("0") or ord(s[i]) > ord("9"):
#                     return False;
#             return True;

#         # 是否是整数，带上符号位
#         def is_int(s):
#             if len(s) == 0:
#                 return False;

#             if s[0] in ["+", "-"]:
#                 return is_digital(s[1:]);
#             return is_digital(s);

#         # 是否是浮点数
#         def is_float(s):
#             if len(s) == 0:
#                 return False;

#             dot_index = -1
#             for i in range(len(s)):
#                 if s[i] == ".":
#                     dot_index = i;
#                     break;
#             if dot_index == -1:
#                 return is_int(s);

#             if dot_index == 0 or s[0:dot_index] in ["+", "-"]:
#                 return is_digital(s[dot_index + 1:]);
#             elif len(s) - (dot_index + 1) == 0:
#                 return is_int(s[0:dot_index]);
#             else:
#                 return is_int(s[0:dot_index]) and is_digital(s[dot_index + 1:]);

#         begin = 0;
#         end = len(s) - 1;
#         while begin < len(s) and s[begin] == " ":
#             begin += 1;
#         while end >= 0 and s[end] == " ":
#             end -= 1;

#         if begin > end:
#             return False;

#         e_index = -1;
#         for i in range(begin, end + 1):
#             if s[i] == "e":
#                 e_index = i;
#                 break;

#         if e_index == -1:
#             return is_float(s[begin:end + 1]);
#         else:
#             return is_float(s[begin:e_index]) and is_int(s[e_index + 1 : end + 1]);



# 使用有限状态机的思路解决问题
# 状态图在"./0065_状态图.jpg"
# 把状态图以表格方式表现出来为
#       空格    "+-"    D    "."    "E"     其他
# (0)   (0)     (1)    (6)   (2)    -1      -1
# (1)   -1      -1     (6)   (2)    -1      -1
# (2)   -1      -1     (3)   -1     -1      -1
# (3)   (8)     -1     (3)   -1     (4)     -1
# (4)   -1      (7)    (5)   -1     -1      -1
# (5)   (8)     -1     (5)   -1     -1      -1
# (6)   (8)     -1     (6)   (3)    (4)     -1
# (7)   -1      -1     (5)   -1     -1      -1
# (8)   (8)     -1     -1    -1     -1      -1
# 并且有状态图可知状态3,5,6,8为终止状态，其他的为中间状态

class Solution(object):
    def isNumber(self, s):
        """
        :type s: str
        :rtype: bool
        """
        def input_index(input_c):
            if input_c == " ":
                return 0;
            elif input_c in ["+", "-"]:
                return 1;
            elif "0" <= input_c <= "9":
                return 2;
            elif input_c == ".":
                return 3;
            elif input_c == "e":
                return 4;
            return 5;

        transfer = [
            [ 0,  1,  6,  2, -1, -1],
            [-1, -1,  6,  2, -1, -1],
            [-1, -1,  3, -1, -1, -1],
            [ 8, -1,  3, -1,  4, -1],
            [-1,  7,  5, -1, -1, -1],
            [ 8, -1,  5, -1, -1, -1],
            [ 8, -1,  6,  3,  4, -1],
            [-1, -1,  5, -1, -1, -1],
            [ 8, -1, -1, -1, -1, -1],
        ];

        finish = [3,5,6,8];

        state = 0;
        for i in range(len(s)):
            index = input_index(s[i]);
            state = transfer[state][index];
            if state == -1:
                break;

        return state in finish;




t = Solution();

t_list = [];
t_list.append(["0", True]);
t_list.append([" 0.1 ", True]);
t_list.append(["abc", False]);
t_list.append(["1 a", False]);
t_list.append(["2e10", True]);
t_list.append([" -90e3   ", True]);
t_list.append([" 1e", False]);
t_list.append(["e3", False]);
t_list.append([" 6e-1", True]);
t_list.append([" 99e2.5 ", False]);
t_list.append(["53.5e93", True]);
t_list.append([" --6 ", False]);
t_list.append(["-+3", False]);
t_list.append(["95a54e53", False]);
t_list.append(["6+1", False]);
t_list.append([".e1", False]);
t_list.append([".", False]);
t_list.append([" ", False]);
t_list.append(["0..", False]);
t_list.append(["+.8", True]);


for i in range(len(t_list)):
    if t.isNumber(t_list[i][0]) != t_list[i][1]:
        print t_list[i][0];
        break;